Memo on lightGBM run on DNV data
In the
gqc-utility-notebooksrepo in theMSImachine, there is agitignoreddata/folder. It contains the utilizedDNVdata and the outputs from the notebooks pertaining tolightGBM.
Make sure thegqc-utility-notebooksvirtual env is selected as the interpreter for the notebook.
![]()
Refer the flow diagrams see the flow of events visually.
From Q&A
Pavan: What are the best model types identified by the research on random tree based methods?
Vannary: LightGBM with oversampling (SMOTE) method is the best for I&I models for both utilities, and lightGBM with class weight is the best for structural models for both utilities.
01_GIS+Prediction_DNV_mapping_defects_version_2.ipynb
This reads in different DNV datasets separately and process them.
The default input / output paths are pointing to this
data/directory.WORKING_DIR = Path('/home/gqc/git/gqc/gqc-utility-notebooks/data')
SHAPE_FILE_DIR = Path('shapefiles')
CONDITION_DATA_DIR = Path('condition_data')
OUTPUT_SHAPE_FILE_DIR = Path('output_shape_files')
FEATURE_ENGINEERING_DATA_DIR = Path('feature_engineering_data')Inputs
Shapefiles:
SanFitting : Might be pipe fittings
SanHistMain: Historical pipe data
SanMain: Pipe data
Condition data:

Video lists:
Outputs
Inspection info:
Shape files with defects:

There will be a group of files like: DNV_81_pacp_code_points.cpg DNV_81_pacp_code_points.dbf DNV_81_pacp_code_points.prj DNV_81_pacp_code_points.shp DNV_81_pacp_code_points.shxRunning the notebook:
- Run all cells up upto
start heresection and runstart here. - Run time is less than 1 minute for all cells.
- The output shape files can be downloaded from
MSImachine to your windows machine and can be opened up in QGIS. (by dragging and dropping into a new QGIS window)
- Run all cells up upto
02_GIS+Prediction_prepare_data_for_defect_prediction_version_2
This notebook combines the different DNV data into a single CSV file, input_DNV_A_B_C_version_3(row_per_pipe_id).csv
Input files


Output files

Running:
- Run all cells except the
prepare csvsection. - Total run time is less than 2 minutes.
- Run all cells except the
03_RandomForest_xgb_lgbm_catboost
This only needs to be run one time for each new dataset to find and save the optimal model parameters. Saved parameters will be used in the next stages.
Input and output file paths and configuration

Running:
- Run everything before
Run heresection. Make sure the paths are correct in theRun heresection. - Select between
I&Iandstructural defectsthrough this line.y=IisI&Iand anything else isstructural defectspredicted_label = '' # 'y=I' - Run will be logged in to
Weights and Biasesin theCCTV_GIS_Predictionproject. A link will appear in the first few lines of the output of the running cell. - Last successful run took 5.5 hours to complete in the
MSImachine.
- Run everything before
04_GIS+Prediction_compile_results_CCTV_prediction_model
Not essential for production runs
Input, output files, and configuration

Running:
- Check the configuration entires and run all cells.
- Runs in few minutes.
05_GIS+Predictions_generate_shap_plot
Not essential for production runs.
Input, output, and configuration.

Running:
- Check the configuration.
- Runs in around 10 minutes.
06_GIS+Predictions_save_the_predictions_to_shape_files
Input, output, and configuration

Running:
- Run all cells.
- Run time 50 min.